#include<iostream>
#include<sstream>
#include<string>
#include"Item.h"

using namespace std;


Item:: Item(DateTime date,string name, double amount, PaymentStatus status)
{
	_date.day=date.day;
	_date.month=date.month;
	_date.year=date.year;
	_name=name;
	_amount=amount;
	_status=status;
}	

void Item:: updateData(DateTime date, string name, double amount,PaymentStatus status)
{
	_date=date;
	_name=name;
	_amount=amount;
	_status=status;
}

double Item:: getAmount()
{
	return _amount;
}

PaymentStatus Item :: getStatus()
{
	return _status;
}

string Item::toString()
{
	ostringstream outstr;
	outstr<<_date.day << " " << _date.month << " " << _date.year << " " << _name<<" "<< _amount << " " << _status << endl;
	return outstr.str();
}

bool Item :: compareDate(DateTime date)
{
	bool ok=true;
	if(date.year==NULL)
		ok=false;
	else if(date.year==_date.year)
		{
			if(date.month!=NULL)
			{
				if(date.month!=_date.month)
					ok=false;
				else
					if(date.day!=NULL)
						if(date.day!=_date.day)
							ok=false;
			}

		}
	else
		ok=false;

	return ok;
}


string Item:: getName()
{
	return _name;
}
DateTime Item:: getDateTime()
{
	return _date;
}
